<body>
    <form id="my-form">
        <div id="tools" class="datagrid-toolbar">
            <input type="hidden" name="type" id="type" value="65">
            <a id="closeBtn" name="backOk" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close"
                plain="true"><span class="l-btn-left"><span
                        class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a>
        </div>
        <p id="errorMsg" style="color:red;margin-top:5px;"></p>
        <table class="formTable">
            <tbody>
                <tr>
                    <td class="tdc1" style="width:150px;">
                        部门/项目经理：
                    </td>
                    <td colspan="3">
                        <input type="text" name="applyUserName" id="applyUserName" data-options="required:true"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="applyUserId" id="applyUserId" value="982">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        录入意见：
                    </td>
                    <td colspan="3">
                        <textarea name="lrOption" id="lrOption" style="width:732px;height:100px"
                            data-options="required:true" class="easyui-validatebox validatebox-text"
                            readonly="">周锋因个人原因申请离职</textarea>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        面谈人：
                    </td>
                    <td colspan="3">
                        <input type="text" name="hrdeptname" id="hrdeptname" class="easyui-validatebox validatebox-text"
                            readonly="">
                        <input type="hidden" name="hrdeptid" id="hrdeptid" value="697">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        副总经理：
                    </td>
                    <td colspan="3">
                        <input type="text" name="deptmanagername" id="deptmanagername"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="deptmanagerid" id="deptmanagerid" value="566">
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        总经理：
                    </td>
                    <td colspan="3">
                        <input type="text" name="managername" id="managername"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="managerid" id="managerid" value="561">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        董事长：
                    </td>
                    <td colspan="3">
                        <input type="text" name="presidentname" id="presidentname"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="presidentid" id="presidentid" value="560">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        姓 名：
                    </td>
                    <td style="width:38%;">
                        <input type="text" name="name" id="name" class="easyui-validatebox validatebox-text"
                            readonly="">
                    </td>
                    <td class="tdc1">
                        所在部门：
                    </td>
                    <td>
                        <input type="text" name="deptname" id="deptname" class="easyui-validatebox validatebox-text"
                            readonly="">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        职 务：
                    </td>
                    <td>
                        <input type="text" name="position" id="position" class="easyui-validatebox validatebox-text"
                            readonly="">
                    </td>
                    <td class="tdc1">
                        到职日期
                    </td>
                    <td>
                        <input type="text" name="starttime" id="starttime" readonly="readonly"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        合同到期日
                    </td>
                    <td>
                        <input type="text" name="dueDate" id="dueDate" readonly="readonly"
                            class="easyui-validatebox validatebox-text">
                    </td>
                    <td class="tdc1">
                        预计离职日
                    </td>
                    <td>
                        <input type="text" name="departureDay" id="departureDay" readonly="readonly"
                            class="easyui-validatebox validatebox-text">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        离职种类
                    </td>
                    <td style="vertical-align: middle" colspan="3">
                        <input type="radio" disabled="true" name="departureType" value="1"
                            style="margin-left:25px;width:15px;" checked="checked">辞职
                        <input type="radio" disabled="true" name="departureType" value="2"
                            style="margin-left:25px;width:15px;">协商解除劳动合同
                        <input type="radio" disabled="true" name="departureType" value="3"
                            style="margin-left:25px;width:15px;">试用不合格
                        <input type="radio" disabled="true" name="departureType" value="4"
                            style="margin-left:25px;width:15px;">劳动合同终止
                        <input type="radio" disabled="true" name="departureType" value="5"
                            style="margin-left:25px;width:15px;">退休
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        离职原因
                    </td>
                    <td colspan="3">
                        <p style="height:35px;padding-top:10px;"><input type="checkbox" disabled="true"
                                name="departureReasons" value="1" style="margin-left:25px;width:15px;">薪资偏低
                            <input type="checkbox" disabled="true" name="departureReasons" value="2"
                                style="margin-left:25px;width:15px;">福利不佳
                            <input type="checkbox" disabled="true" name="departureReasons" value="3"
                                style="margin-left:25px;width:15px;">无晋升机会
                            <input type="checkbox" disabled="true" name="departureReasons" value="4"
                                style="margin-left:25px;width:15px;">工作环境
                            <input type="checkbox" disabled="true" name="departureReasons" value="5"
                                style="margin-left:25px;width:15px;">工作时间长
                        </p>
                        <p style="height:35px;"><input type="checkbox" disabled="true" name="departureReasons" value="6"
                                style="margin-left:25px;width:15px;">人际关系
                            <input type="checkbox" disabled="true" name="departureReasons" value="7"
                                style="margin-left:25px;width:15px;">上学进修
                            <input type="checkbox" disabled="true" name="departureReasons" value="8"
                                style="margin-left:25px;width:15px;">健康因素&nbsp;&nbsp;&nbsp;
                            <input type="checkbox" disabled="true" name="departureReasons" value="9"
                                style="margin-left:25px;width:15px;">家庭因素
                            <input type="checkbox" disabled="true" name="departureReasons" value="10"
                                style="margin-left:25px;width:15px;">交通不便
                        </p>
                        <p style="height:35px;"><input type="checkbox" disabled="true" name="departureReasons"
                                id="ctrothers" value="11" style="margin-left:25px;width:15px;">其他
                            <input type="text" name="others" id="others" class="easyui-validatebox validatebox-text"
                                readonly="">
                        </p>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        相关附件：
                    </td>
                    <td>
                        <div style="margin-left:10px;">
                            <div id="showFiles">
                                <div style="margin-top:8px;margin-bottom:8px;">离职申请书（周锋）.pdf<a style="margin-left:10px"
                                        href="javascript:" onclick="downfile(776758)">下载</a></div>
                            </div>

                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        对公司建议：
                    </td>
                    <td colspan="3">
                        <textarea name="suggest" id="suggest" style="width:732px;height:100px" readonly=""></textarea>
                    </td>
                </tr>
                <tr>
                    <td class="tdc1">
                        离职面谈记录：
                    </td>
                    <td colspan="3">
                        <textarea name="departureRecord" id="departureRecord" style="width:732px;height:100px"
                            readonly=""></textarea>
                    </td>
                </tr>

            </tbody>
        </table>
    </form>
    <div style="margin-left:10px;">
        <div id="showRecords">
            <div style="margin-top:8px;margin-bottom:8px;">审核人：韩威<span style="margin-left:15px;">审核时间：2025-10-13
                    17:27:49</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">审核人：王维<span style="margin-left:15px;">审核时间：2025-10-13
                    09:03:57</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">审核人：沈全洪<span style="margin-left:15px;">审核时间：2025-10-13
                    21:01:10</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">审核人：张金生<span style="margin-left:15px;">审核时间：2025-10-14
                    16:55:33</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">复核人：王一翀<span style="margin-left:15px;">复核时间：2025-10-15
                    08:46:16</span><span style="margin-left:15px;">复核选项：同意</span><span
                    style="margin-left:15px;">复核意见：同意</span></div>
        </div>
    </div>


    <script>

        function checkFormMe(form) {

            return $('#my-form').form('validate');
        }

        var type = $.getUrlParam("type");

        $("#type").val(type);

        var p_id = $.getUrlParam("id");


        var process_id = $.getUrlParam("processid");
        if (process_id != null) {
            $.ajax({
                type: "GET",
                url: contextPath + "manager/approvalprocess/getBeanIdByProcessId/" + process_id + "/" + type,
                data: null,
                dataType: "json",
                success: function (data) {
                    if (data && data.handleMsg.status == 1) {
                        p_id = data.id;
                        if (p_id != null) {
                            objectId = p_id;
                        }
                        $("#objectId").val(objectId);

                        loadBassModel(p_id);

                        loadRecord(process_id);
                    }
                },
                error: function (response) {
                    $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                        $.messager.alert("提示", response.responseText, 'error');
                    });
                }

            });
        } else {
            objectId = p_id;
            $("#objectId").val(objectId);
            loadBassModel(p_id);
        }
        function loadBassModel(p_id) {
            var BaseModel = Backbone.Model.extend({ urlRoot: contextPath + 'manager/personDeparture' });
            var baseModel;

            if (p_id == null) {
                baseModel = new BaseModel();
            } else {
                baseModel = new BaseModel({ id: p_id, i: new Date().getTime() });
            }
            var baseView = new BaseView({ el: $("#my-form"), model: baseModel });

            if (p_id != null) {
                baseView.doLoad(loadMe);
            }
        }


        function loadMe(model, response, options) {
            if (model.get("approvalProcess")) {

                $("#applyUserName").val(model.get("approvalProcess").applyUserName);
                $("#applyUserId").val(model.get("approvalProcess").applyUserId);
                $("#type").val(model.get("approvalProcess").type);
                $("#lrOption").text(model.get("lrOption"));
                getAffixs();
            }
        }

        function getAffixs() {
            $.ajax({
                type: "POST",
                url: contextPath + "affixs",
                data: { "objectType": 651, objectId: objectId },
                dataType: "json",
                success: function (data) {
                    if (data && data.length > 0) {
                        showAffixs(data);
                    } else {
                        $("#showFiles").html("");
                    }
                },
                error: function (response) {
                    $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                        $.messager.alert("提示", response.responseText, 'error');
                    });
                }

            });
        }


        function showAffixs(data) {
            var fileHtml = "";
            for (var i = 0; i < data.length; i++) {
                fileHtml += "<div style=\"margin-top:8px;margin-bottom:8px;\">" + data[i].name;
                fileHtml += "<a style=\"margin-left:10px\" href=\"javascript:\" onclick=\"downfile(" + data[i].id + ")\">下载</a>";
            }
            $("#showFiles").html(fileHtml);
        }

        ////加载领导审核意见
        function loadRecord(process_id) {
            $.ajax({
                type: "POST",
                url: contextPath + "manager/approvalRecords/listApprovalRecord/" + process_id,
                data: {},
                dataType: "json",
                success: function (data) {
                    if (data) {
                        var rHtml = "";
                        var msg = "审核"
                        for (var i = 0; i < data.length; i++) {
                            if (data[i].userType == 5) {
                                msg = "复核";
                            } else {
                                msg = "审核"
                            }
                            rHtml += "<div style=\"margin-top:8px;margin-bottom:8px;\">" + msg + "人：" + data[i].approvalUser.truename + "";
                            if (data[i].approvalDate == null) {
                                rHtml += "<span style=\"margin-left:15px;\">尚未" + msg + "</span>";
                            } else {
                                rHtml += "<span style=\"margin-left:15px;\">" + msg + "时间：" + data[i].approvalDate + "</span>";
                                if (data[i].approvalType == 1) {
                                    rHtml += "<span style=\"margin-left:15px;\">" + msg + "选项：同意</span>";
                                } else {
                                    rHtml += "<span style=\"margin-left:15px;\">" + msg + "选项：不同意</span>";
                                }
                                rHtml += "<span style=\"margin-left:15px;\">" + msg + "意见：" + data[i].opinion + "</span>";
                            }
                            rHtml += "</div>";
                        }
                        $("#showRecords").html(rHtml);
                    }
                },
                error: function (response) {
                    $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                        $.messager.alert("提示", response.responseText, 'error');
                    });
                }
            });
        }

        var userType = $.getUrlParam("userType");


    </script>
    <div id="loading1"
        style="position: absolute; left: 0px; top: 0px; width: 100%; height: 787px; background: rgb(232, 232, 232); opacity: 0.5; z-index: 10000; display: none;">
    </div>
    <div id="loading2" class="panel-loading"
        style="position: fixed; top: 38%; left: 41%; border: 2px solid rgb(149, 184, 231); width: 160px; font-size: 14px; z-index: 10001; background: url(&quot;/system/jquery/themes/themes1/images/loading-1.gif&quot;) 10px 8px no-repeat rgb(255, 255, 255); display: none;">
        正在处理，请稍等...</div>
</body>